#pragma once

#include "e2d/core/Component.h"
#include "e2d/core/EntityMap.h"
#include "e2d/core/render/MaterialView.h"
#include "e2d/core/render/Maps.h"

namespace e2d
{
	
	struct SkinnedMeshRender :public e2d::Component
	{
		FXCC_DEFINE_COMPONENT_LABEL(SkinnedMeshRender);

		e2d::EntityMap m_RootNode;
		
		e2d::MaterialViewMap m_MaterialView;

		e2d::SkinnedMeshMap m_MeshMap;

		e2d::BoneFileMap m_BoneFileMap;;

		e2d::Effect3d::BoneData m_BoneData;

		bool m_Rendering{ false };

		void InitRootNodeIfNull();

		void OnLoad() override;

		void OnStart() override;

		void OnUpdate() override;

		void OnUpdateRuntime() override;
	
		void OnDestroy() override;

		void SetBoneEntities();

		bool ProcessEntityNode(e2d::Entity* entity);

		std::shared_ptr<fxcc::graph::common::MeshJack> GetMesh() const;

	};

};